3 * This is to display changes made to all articles linked in an article.
9 require_once( 'SpecialRecentchanges.php' );
13 * @param string $par parent page we will look at
15 function wfSpecialRecentchangeslinked( $par = NULL ) {
16 global $wgUser, $wgOut, $wgLang, $wgTitle, $wgRequest;
17 $fname = 'wfSpecialRecentchangeslinked';
19 $days = $wgRequest->getInt( 'days' );
20 $target = $wgRequest->getText( 'target' );
21 $hideminor = $wgRequest->getBool( 'hideminor' ) ?
1 : 0;
23 $wgOut->setPagetitle( wfMsg( "recentchanges" ) );
24 $sk = $wgUser->getSkin();
30 $wgOut->errorpage( 'notargettitle', 'notargettext' );
33 $nt = Title
::newFromURL( $target );
35 $wgOut->errorpage( 'notargettitle', 'notargettext' );
38 $id = $nt->getArticleId();
40 $wgOut->setSubtitle( wfMsg( 'rclsub', $nt->getPrefixedText() ) );
43 $days = $wgUser->getOption( 'rcdays' );
44 if ( ! $days ) { $days = 7; }
47 list( $limit, $offset ) = wfCheckLimits( 100, 'rclimit' );
49 $dbr =& wfGetDB( DB_SLAVE
);
50 $cutoff = $dbr->timestamp( time() - ( $days * 86400 ) );
52 $hideminor = ($hideminor ?
1 : 0);
54 $mlink = $sk->makeKnownLink( $wgLang->specialPage( 'Recentchangeslinked' ),
55 WfMsg( 'show' ), 'target=' . htmlspecialchars( $nt->getPrefixedURL() ) .
56 "&days={$days}&limit={$limit}&hideminor=0" );
58 $mlink = $sk->makeKnownLink( $wgLang->specialPage( "Recentchangeslinked" ),
59 WfMsg( "hide" ), "target=" . htmlspecialchars( $nt->getPrefixedURL() ) .
60 "&days={$days}&limit={$limit}&hideminor=1" );
63 $cmq = 'AND cur_minor_edit=0';
66 extract( $dbr->tableNames( 'cur', 'links' ) );
68 $sql = "SELECT cur_id,cur_namespace,cur_title,cur_user,cur_comment," .
69 "cur_user_text,cur_timestamp,cur_minor_edit,cur_is_new FROM $links, $cur " .
70 "WHERE cur_timestamp > '{$cutoff}' {$cmq} AND l_to=cur_id AND l_from=$id " .
71 "GROUP BY cur_id,cur_namespace,cur_title,cur_user,cur_comment,cur_user_text," .
72 "cur_timestamp,cur_minor_edit,cur_is_new,inverse_timestamp ORDER BY inverse_timestamp LIMIT {$limit}";
73 $res = $dbr->query( $sql, $fname );
75 $wgOut->addHTML("< ".$sk->makeKnownLinkObj($nt, "", "redirect=no" )."<br />\n");
76 $note = wfMsg( "rcnote", $limit, $days );
77 $wgOut->addHTML( "<hr />\n{$note}\n<br />" );
79 $note = rcDayLimitlinks( $days, $limit, "Recentchangeslinked",
80 "target=" . $nt->getPrefixedURL() . "&hideminor={$hideminor}",
83 $wgOut->addHTML( $note."\n" );
85 $s = $sk->beginRecentChangesList();
86 $count = $dbr->numRows( $res );
90 if ( 0 == $count ) { break; }
91 $obj = $dbr->fetchObject( $res );
94 $rc = RecentChange
::newFromCurRow( $obj );
95 $rc->counter
= $counter++
;
96 $s .= $sk->recentChangesLine( $rc );
99 $s .= $sk->endRecentChangesList();
101 $dbr->freeResult( $res );
102 $wgOut->addHTML( $s );